package com.logicwin.aibala.ui.screens.screenmain;

import com.logicwin.aibala.action.DownloadSoftwareAction;
import com.logicwin.aibala.detailPackActivity.DetailDesc;
import com.logicwin.aibala.model.androidSWInfo.APKListItem;

import android.os.Message;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;

public class ListViewItemButtonClickListener implements OnClickListener{

	private APKListItem mListItem;
	private String mType = "";
	private DownloadSoftwareAction downloadAction = null;
	
	public ListViewItemButtonClickListener(APKListItem item, String type){
		mListItem = item;
		mType = type;
	}
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		Log.i("ListViewItemButtonClickListener",mListItem.getAPKName());
		if (mType.equals("download")){
			downloadAction = DownloadSoftwareAction.getInstance(mListItem.getID());
			downloadAction.startAction(mListItem.getAPKAddress(),mListItem.getID());
		}
		else if (mType.equals("cancel")){
			downloadAction = DownloadSoftwareAction.getInstance(mListItem.getID());
			downloadAction.stop();
		}
	}
	
}
